package kin.service.security;

import java.io.Serializable;
import java.util.List;

import kin.bean.security.Role;
import kin.bean.security.User;


import org.springframework.security.core.userdetails.UserDetailsService;

public interface UserServiceManager extends UserDetailsService {
	
	public User login(User user);
	
	public void add(User user) throws Exception;
	
	public void update(User user);
	
	public void delete(Serializable entityId) throws Exception;
	
	public List<User> findAll();
	
	public User load(int id);
	public boolean usernameExist(String username);	
	
	/**
	 * 查询某用户拥有的所有角色
	 * @param userId   用户Id
	 * @return    角色列表
	 */
	public List<Role> findRolesByUser(int userId);


	/**
	 * 增加或修改用户拥有的角色
	 * @param userId  用户Id
	 * @param roleId  角色Id
	 * @param usersroles_orderNo 角色的优先级
	 */
	public void addOrUpdateRoleByUser(User user,Role role,int usersroles_orderNo)throws Exception;

	/**
	 * 删除用户拥有的某个角色
	 * @param userId     用户Id
	 * @param roleId     角色Id
	 */
	public void deleteRoleByUser(int userId,int roleId);
		
	public User findByUsername(String username);
	
	
	
	
	
	
	
	
}
